<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/fragment :: head('新增分类')">
</head>
<body>
<!--导航 ui表示ui inverted与当前色相反  attached表依附，去圆角  segment表片段-->
<div th:replace="admin/fragment :: menu(2)"></div>
<!--菜单中选中的样式  pointing-->
<div class="ui menu attached pointing right aligned">
    <div class="ui container">
        <div class="right menu">
            <a href="#" class="ui item active teal">发布</a>
            <a href="#" class="item">列表</a>
        </div>
    </div>
</div>
<!--中间内容-->
<div class="m-padded-tb-large">
    <div class="ui container">
        <form action="#" th:object="${type}" th:action="*{id}==null ? @{/admin/types/add}: @{/admin/types/edit}" method="post"  class="ui form">
            <input type="hidden" name="id" th:value="*{id}">
            <div class="field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">名称</label>
                    <input type="text" name="name" placeholder="分类名称" class="required" th:value="*{name}">
                </div>

            </div>
            <div class="ui error message"></div>
            <!--/*/
            <div class="ui negative message" th:if="${#fields.hasErrors('name')}">
                <i class="icon close"></i>
                <div class="header">验证失败</div>
                <p th:errors="*{name}">输入不符合规范</p>
            </div>
            /*/-->
            <div class="ui right aligned container">
                <a class="ui button" type="button" th:href="@{/admin/types}">返回</a>
                <button class="ui button teal" >提交</button>
            </div>
        </form>
    </div>
    <br>
    <br>
    <br>
    <br>

</div>


<!--底部  vertical垂直-->
<!--<div th:replace="admin/fragment :: footer"></div>-->

<div th:replace="admin/fragment :: script"></div>
<script>

    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
        on: 'hover'
    });

    $('#multi-select').dropdown({
        on: 'hover'
    });


    $(".message .close").on('click',function () {
        $(this).closest(".message").transition('fade');
    });
</script>


</body>

</html>